<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>

      <transition name="hello1">
        <h1 class="title1" v-show="isShow">你好1</h1>
      </transition>

      <transition name="hello2">
        <h1 class="title2" v-show="isShow">你好2</h1>
      </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  h1 {
    background-color: orange;
  }
  .title1 {
    transition: 3s linear;
  }
  .title2 {
    transition: 1s linear;
  }
  /* 离开的起点、进入的终点 */
  .hello1-leave,.hello1-enter-to {
    transform: translateX(0);
  }
  /* 离开的终点、进入的起点 */
  .hello1-leave-to,.hello1-enter {
    transform: translateX(-100%);
  }

  /* 离开的起点、进入的终点 */
  .hello2-leave,.hello2-enter-to {
    transform: translateX(0);
  }
  /* 离开的终点、进入的起点 */
  .hello2-leave-to,.hello2-enter {
    transform: translateX(100%);
  }
</style>